<?php
/**
 * 系统参数类
 *
 * @version 	0.0.1
 */

class Systemparam extends Model
{

	// ------------------------------------------------------------------------
	/**
	 * initialises the class inheriting the methods of the class Model
	 *
	 * @return Systemparam
	 */
    function Systemparam()
    {
        parent::Model();
    }

    // ------------------------------------------------------------------------

    /**
     * Enter description here...
     *
     * @return unknown
     */
    function getParamForSelect()
    {
	    $this->db->select('id, name');
	    $query = $this->db->get($this->_prefix.'country');

	    $options['0']="-----------------";

	    foreach ($query->result() as $row)
	   	{
	            $options[$row->{'id'}] = $row->{'name'};
	   	}

	   	$query->free_result();

	   	return $options;
    }

    function getParamByParentId($id)
    {
        $this->db->select('*');
        $this->db->where('pid', $id);
        $query = $this->db->get('sysparam');

        if ($query->num_rows() > 0)
        {

            return $query->result();

        }
    	return null;
    }

}